﻿using FluentValidation;
using FluentValidation.Attributes;
using Quickie.Models;
using Quickie.Models.IoC;
using Quickie.Models.Data;
using Quickie.Models.Entities;
using Quickie.Models.ViewModel;
using Quickie.Models.Interfaces;

namespace Quickie.Models.Entities
{
    [Validator(typeof(PersonValidation))]
    public partial class Person : IEntity
    {

    }

    public class PersonValidation : AbstractValidator<Person>
    {
        public PersonValidation()
        {
            RuleFor(x => x.Name)
                .NotEmpty()
                .WithMessage("Unesite ime osobe");

            RuleFor(x => x.Surname)
                .NotEmpty()
                .WithMessage("Unesite prezime osobe");

            RuleFor(x => x.CompanyID)
                .NotNull()
                .GreaterThan(0)
                .WithMessage("Morate odabrati kategoriju");
            
        }

    }
}
